/*
 * @Description:
 * @Author: r_yuesheng
 * @Date: 2022-04-08 13:48:37
 * @LastEditTime: 2022-04-09 14:15:33
 * @LastEditors: r_yuesheng
 */
const path = require('path');
const { generateTheme } = require('antd-theme-generator');
const options = {
  stylesDir: path.join(__dirname, './src/styles'),
  antDir: path.join(__dirname, './node_modules/antd'),
  varFile: path.join(__dirname, './src/styles/variables.less'),
  mainLessFile: path.join(__dirname, './src/styles/index.less'),
  themeVariables: [
    //需要动态切换的主题变量
    '@primary-color',
    '@secondary-color',
    '@text-color',
    '@text-color-secondary',
    '@heading-color',
    '@layout-body-background',
    '@border-color-base'
  ],
  indexFileName: 'index.html',
  outputFilePath: path.join(__dirname, './public/theme.less') //页面引入的主题变量文件
};
generateTheme(options)
  .then(less => {
    console.log(less);
    console.log('Theme generated successfully');
  })
  .catch(error => {
    console.log('Error', error);
  });
